******************************************************************DETAILS
/* 	This do-file analyzes the data set "dempref.dta" to replicate
	Klingelhoefer and Rahat (2026) - Which Democracy Do Political Parties Want? The Role of Party Personalism.
	To create the file "dempref.dta", execute the do-file "create_dempref.do" */

	
******************************************************************A. preliminaries 
* Create a folder named "Klingelhoefer Rahat 2026 replication" and set as global macro and working directory; here exemplarily:
global file = "C:\Users\abc\Desktop\Klingelhoefer Rahat 2026 replication"
cd "$file"
pwd

* load data
use "$file\dempref.dta", clear


******************************************************************B. relationships between DVs and IVs (Endnote 2 and Table A.3)
pwcorr liberalism consensus, sig
pwcorr direct liberalism, sig
pwcorr direct consensus, sig

pwcorr personal_std leader_std network_std movement_std, sig


******************************************************************C. Regression analyses
***Table 1: Direct democracy
reg direct personal_std
reg direct leader_std
reg direct network_std
reg direct movement_std

reg direct personal_std i.country_id
reg direct leader_std i.country_id
reg direct network_std i.country_id
reg direct movement_std i.country_id

reg direct personal_std i.pfam i.country_id
est sto m11
reg direct leader_std i.pfam i.country_id
est sto m12
reg direct network_std i.pfam i.country_id
est sto m13
reg direct movement_std i.pfam i.country_id
est sto m14

esttab m1* using "$file\DV1 Direct.rtf", ///
	order(personal_std leader_std network_std movement_std) ///
	b(2) se(2) ar2(2) star(* 0.10 ** 0.05 *** 0.01) replace


***Table 2: Liberalism 
reg liberalism personal_std
reg liberalism leader_std
reg liberalism network_std
reg liberalism movement_std

reg liberalism personal_std i.country_id
reg liberalism leader_std i.country_id
reg liberalism network_std i.country_id
reg liberalism movement_std i.country_id

reg liberalism personal_std i.pfam i.country_id
est sto m21
reg liberalism leader_std i.pfam i.country_id
est sto m22
reg liberalism network_std i.pfam i.country_id
est sto m23
reg liberalism movement_std i.pfam i.country_id
est sto m24

esttab m2* using "$file\DV2 Liberalism.rtf", ///
	order(personal_std leader_std network_std movement_std) ///
	b(2) se(2) ar2(2) star(* 0.10 ** 0.05 *** 0.01) replace

	
***Table 3: Consensus
reg consensus personal_std
reg consensus leader_std
reg consensus network_std
reg consensus movement_std

reg consensus personal_std i.country_id
reg consensus leader_std i.country_id
reg consensus network_std i.country_id
reg consensus movement_std i.country_id

reg consensus personal_std i.pfam i.country_id
est sto m31
reg consensus leader_std i.pfam i.country_id
est sto m32
reg consensus network_std i.pfam i.country_id
est sto m33
reg consensus movement_std i.pfam i.country_id
est sto m34

esttab m3* using "$file\DV3 Consensus.rtf", ///
	order(personal_std leader_std network_std movement_std) ///
	b(2) se(2) ar2(2) star(* 0.10 ** 0.05 *** 0.01) replace

	
******************************************************************D. Robustness checks (Appendix)
* more than 3 coders (Table A.4)
reg liberalism personal_std i.pfam i.country_id if liberalism_nr > 3 & personal_nr > 3
est sto mRC11
reg liberalism leader_std i.pfam i.country_id if liberalism_nr > 3 & personal_nr > 3
est sto mRC12
reg liberalism network_std i.pfam i.country_id if liberalism_nr > 3 & personal_nr > 3
est sto mRC13
reg liberalism movement_std i.pfam i.country_id if liberalism_nr > 3 & personal_nr > 3
est sto mRC14

reg consensus personal_std i.pfam i.country_id if consensus_nr > 3 & personal_nr > 3
est sto mRC15
reg consensus leader_std i.pfam i.country_id if consensus_nr > 3 & personal_nr > 3
est sto mRC16
reg consensus network_std i.pfam i.country_id if consensus_nr > 3 & personal_nr > 3
est sto mRC17
reg consensus movement_std i.pfam i.country_id if consensus_nr > 3 & personal_nr > 3
est sto mRC18

esttab mRC1* using "$file\RC1 more than 3 coders.rtf", ///
	order(personal_std leader_std network_std movement_std) ///
	b(2) se(2) ar2(2) star(* 0.10 ** 0.05 *** 0.01) replace

* Liberalism variable with mean rather than V-Party aggregation model (Table A.5)
reg liberalism_mean personal_std i.pfam i.country_id 
est sto mRC21
reg liberalism_mean leader_std i.pfam i.country_id 
est sto mRC22
reg liberalism_mean network_std i.pfam i.country_id 
est sto mRC23
reg liberalism_mean movement_std i.pfam i.country_id 
est sto mRC24

esttab mRC2* using "$file\RC2 Liberalism mean.rtf", ///
	order(personal_std leader_std network_std movement_std) ///
	b(2) se(2) ar2(2) star(* 0.10 ** 0.05 *** 0.01) replace

* without US (Table A.6)
reg liberalism network_std i.pfam i.country_id if country_name != "United States of America"
est sto mRC31
reg liberalism movement_std i.pfam i.country_id if country_name != "United States of America"
est sto mRC32
reg consensus network_std i.pfam i.country_id if country_name != "United States of America"
est sto mRC33
reg consensus movement_std i.pfam i.country_id if country_name != "United States of America"
est sto mRC34

esttab mRC3* using "$file\RC3 wo US.rtf", ///
	order(personal_std leader_std network_std movement_std) ///
	b(2) se(2) ar2(2) star(* 0.10 ** 0.05 *** 0.01) replace
	

* cluster standard errors in addition (Table A.7)
reg direct personal_std i.pfam i.country_id, cluster(country_id)
est sto mRC41
reg direct leader_std i.pfam i.country_id, cluster(country_id)
est sto mRC42
reg direct network_std i.pfam i.country_id, cluster(country_id)
est sto mRC43
reg direct movement_std i.pfam i.country_id, cluster(country_id)
est sto mRC44

reg liberalism personal_std i.pfam i.country_id, cluster(country_id)
est sto mRC45
reg liberalism leader_std i.pfam i.country_id, cluster(country_id)
est sto mRC46
reg liberalism network_std i.pfam i.country_id, cluster(country_id)
est sto mRC47
reg liberalism movement_std i.pfam i.country_id, cluster(country_id)
est sto mRC48

reg consensus personal_std i.pfam i.country_id, cluster(country_id)
est sto mRC490
reg consensus leader_std i.pfam i.country_id, cluster(country_id)
est sto mRC491
reg consensus network_std i.pfam i.country_id, cluster(country_id)
est sto mRC492
reg consensus movement_std i.pfam i.country_id, cluster(country_id)
est sto mRC493

esttab mRC4* using "$file\RC4 cluster.rtf", ///
	order(personal_std leader_std network_std movement_std) ///
	b(2) se(2) ar2(2) star(* 0.10 ** 0.05 *** 0.01) replace

